<%@page pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>用户数据可视化页面</title>
    <script src="${path}/Echarts-js/echarts.js"></script>
    <script src="${path}/bootstrap/js/jquery.min.js"></script>
</head>
<body>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main" style="width: 1200px;height:800px;"></div>
<script type="text/javascript">
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option;

    $.get("${path}/user/showEchartsUser",function (data){
        option = {
            title: {
                text: '新增用户概况',
                textStyle:{
                    fontSize: 25
                },
                subtext:'当前用户数量为:'+data.total,
                subtextStyle:{
                    fontSize: 15
                }
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['每月新增用户量']
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    name: '每月新增用户量',
                    type: 'line',
                    stack: 'Total',
                    data: data.countUser
                }
            ]
        };

        option && myChart.setOption(option);
    });

</script>
</body>
</html>